Skip to content

regression: timezone field blank for legacy aliases#40305

Open
dougfabris wants to merge 2 commits intorelease-8.4.0from
fix/timezone-legacy-aliases
Open

regression: timezone field blank for legacy aliases#40305
dougfabris wants to merge 2 commits intorelease-8.4.0from
fix/timezone-legacy-aliases

Conversation

@dougfabris
Copy link
Copy Markdown
Member

@dougfabris dougfabris commented Apr 24, 2026

Proposed changes (including videos or screenshots)

Summary

Restores compatibility for legacy timezone aliases (UTC, Etc/UTC, US/Pacific, Japan, …) that were lost when #40076 migrated the timezone list from moment.tz.names() (597 zones) to Intl.supportedValuesOf('timeZone') (418 zones). Any Select fed by useTimezoneNameList — Business Hours and the admin Timezone setting — rendered empty for workspaces whose saved value was one of the 179 dropped aliases.

  • Add canonicalizeTimezone in @rocket.chat/tools — resolves legacy aliases to their canonical IANA zone via Intl.DateTimeFormat, falling back to the input on invalid values.
  • Ensure UTC is always present in useTimezoneNameList, since Intl.supportedValuesOf omits it on several ICU versions.
  • Apply canonicalization when loading the saved value in EditBusinessHours and SelectTimezoneSettingInput, so existing documents render correctly and are gradually rewritten to canonical form on save.

Test plan

  • On a workspace with a Business Hour saved as timezone.name === "UTC" (pre-8.4), open it on this branch — field shows UTC, save persists UTC.
  • Repeat with US/Pacific — field shows America/Los_Angeles, saves as America/Los_Angeles.
  • Admin → General → Timezone: a legacy-aliased value loads into the select.

Issue(s)

Steps to test or reproduce

Further comments

CORE-2135

Summary by CodeRabbit

  • New Features

    • Enhanced timezone handling to ensure UTC is always available in timezone selection dropdowns.
  • Bug Fixes

    • Improved timezone value normalization in admin settings and business hours configuration for consistent selection behavior.
  • Tests

    • Added comprehensive test coverage for timezone canonicalization functionality.

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented Apr 24, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 24, 2026

⚠️ No Changeset found

Latest commit: 9b69d16

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

Walkthrough

This PR adds a new timezone canonicalization utility that normalizes timezone identifiers to their canonical IANA forms using the Intl API. The utility is applied to timezone dropdowns and form initialization across the codebase to ensure consistent timezone value handling. Additionally, the timezone list hook is updated to always include UTC.

Changes

Cohort / File(s) Summary
Timezone Canonicalization Utility
packages/tools/src/timezone.ts
New exported canonicalizeTimezone function that validates and normalizes timezone identifiers using Intl.DateTimeFormat, returning the input unchanged if invalid/unsupported.
Timezone Canonicalization Tests
packages/tools/src/timezone.spec.ts
New Jest test suite with cases covering canonical IANA strings, UTC normalization, legacy aliases (e.g., GMT, US/Pacific), and unrecognized timezone handling.
UI Component Applications
apps/meteor/client/views/admin/settings/Setting/inputs/SelectTimezoneSettingInput.tsx, apps/meteor/client/views/omnichannel/businessHours/EditBusinessHours.tsx
Applies canonicalizeTimezone to normalize timezone values before passing to form components and during initial state construction.
Timezone Name List Hook
apps/meteor/client/hooks/useTimezoneNameList.ts
Ensures the timezone name list always includes 'UTC' by prepending it if not already present in supported values.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

type: bug

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'regression: timezone field blank for legacy aliases' accurately describes the main problem being fixed: restoring support for legacy timezone aliases that were previously broken, causing timezone fields to appear blank. The title is concise, specific, and directly related to the core issue addressed in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2135: Request failed with status code 401

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dougfabris dougfabris added this to the 8.4.0 milestone Apr 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

❌ Patch coverage is 18.18182% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.97%. Comparing base (92dbb53) to head (9b69d16).
⚠️ Report is 1 commits behind head on release-8.4.0.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                @@
##           release-8.4.0   #40305      +/-   ##
=================================================
+ Coverage          69.74%   69.97%   +0.22%     
=================================================
  Files               3298     3299       +1     
  Lines             119292   120106     +814     
  Branches           21469    21499      +30     
=================================================
+ Hits               83206    84043     +837     
+ Misses             32785    32776       -9     
+ Partials            3301     3287      -14     
Flag Coverage Δ
e2e 59.65% <25.00%> (-0.02%) ⬇️
e2e-api 46.23% <ø> (-0.04%) ⬇️
unit 70.82% <10.00%> (+0.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dougfabris dougfabris marked this pull request as ready for review April 25, 2026 20:36
@dougfabris dougfabris requested a review from a team as a code owner April 25, 2026 20:36
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
apps/meteor/client/hooks/useTimezoneNameList.ts (1)

5-7: Prepending UTC breaks the alphabetical ordering of the dropdown.

Intl.supportedValuesOf('timeZone') returns a sorted list, so the rest of the dropdown is alphabetical and the user-visible position of UTC will be at the very top instead of between Turkey/US/... (i.e., near the bottom). If you want to preserve the existing alphabetical UX when UTC is missing from ICU, insert it in the correct position (or just sort).

♻️ Possible tweak
-	const names = typeof intl.supportedValuesOf === 'function' ? intl.supportedValuesOf('timeZone') : [];
-	return names.includes('UTC') ? names : ['UTC', ...names];
+	const names = typeof intl.supportedValuesOf === 'function' ? intl.supportedValuesOf('timeZone') : [];
+	return names.includes('UTC') ? names : [...names, 'UTC'].sort();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/client/hooks/useTimezoneNameList.ts` around lines 5 - 7, The code
in useTimezoneNameList currently prepends 'UTC' which breaks the alphabetical
sort from Intl.supportedValuesOf('timeZone'); instead ensure 'UTC' is present
but keep the list sorted: call intl.supportedValuesOf('timeZone') to get names,
if 'UTC' is missing add it (e.g., push or add to a Set) and then produce a
deduplicated, alphabetically sorted array (using localeCompare or
Array.prototype.sort()) before returning; reference intl.supportedValuesOf, the
names variable, and the useTimezoneNameList function to locate and change the
logic.
apps/meteor/client/views/admin/settings/Setting/inputs/SelectTimezoneSettingInput.tsx (1)

42-42: Optional: memoize the canonicalized value.

Minor — canonicalizeTimezone builds a new Intl.DateTimeFormat on every render of every timezone setting on the admin page. Not a real hot path, but easy to wrap in useMemo keyed on value if you want to avoid the repeated work.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/meteor/client/views/admin/settings/Setting/inputs/SelectTimezoneSettingInput.tsx`
at line 42, The component SelectTimezoneSettingInput currently calls
canonicalizeTimezone(value) inline causing a new Intl.DateTimeFormat to be
created on every render; wrap that result in React's useMemo so the
canonicalized value is recomputed only when value changes (key the memo on value
and keep the same conditional typeof value === 'string' check), and add the
useMemo import if missing; replace the inline expression value={typeof value ===
'string' ? canonicalizeTimezone(value) : value} with a memoized variable (e.g.,
canonicalValue = useMemo(() => typeof value === 'string' ?
canonicalizeTimezone(value) : value, [value])) and use canonicalValue as the
prop.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/meteor/client/hooks/useTimezoneNameList.ts`:
- Around line 5-7: The code in useTimezoneNameList currently prepends 'UTC'
which breaks the alphabetical sort from Intl.supportedValuesOf('timeZone');
instead ensure 'UTC' is present but keep the list sorted: call
intl.supportedValuesOf('timeZone') to get names, if 'UTC' is missing add it
(e.g., push or add to a Set) and then produce a deduplicated, alphabetically
sorted array (using localeCompare or Array.prototype.sort()) before returning;
reference intl.supportedValuesOf, the names variable, and the
useTimezoneNameList function to locate and change the logic.

In
`@apps/meteor/client/views/admin/settings/Setting/inputs/SelectTimezoneSettingInput.tsx`:
- Line 42: The component SelectTimezoneSettingInput currently calls
canonicalizeTimezone(value) inline causing a new Intl.DateTimeFormat to be
created on every render; wrap that result in React's useMemo so the
canonicalized value is recomputed only when value changes (key the memo on value
and keep the same conditional typeof value === 'string' check), and add the
useMemo import if missing; replace the inline expression value={typeof value ===
'string' ? canonicalizeTimezone(value) : value} with a memoized variable (e.g.,
canonicalValue = useMemo(() => typeof value === 'string' ?
canonicalizeTimezone(value) : value, [value])) and use canonicalValue as the
prop.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a732ff64-a483-4e08-bdc8-342edb071d46

📥 Commits

Reviewing files that changed from the base of the PR and between 957625f and 9b69d16.

📒 Files selected for processing (5)
  • apps/meteor/client/hooks/useTimezoneNameList.ts
  • apps/meteor/client/views/admin/settings/Setting/inputs/SelectTimezoneSettingInput.tsx
  • apps/meteor/client/views/omnichannel/businessHours/EditBusinessHours.tsx
  • packages/tools/src/timezone.spec.ts
  • packages/tools/src/timezone.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/views/omnichannel/businessHours/EditBusinessHours.tsx
  • packages/tools/src/timezone.ts
  • apps/meteor/client/views/admin/settings/Setting/inputs/SelectTimezoneSettingInput.tsx
  • apps/meteor/client/hooks/useTimezoneNameList.ts
  • packages/tools/src/timezone.spec.ts
**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • packages/tools/src/timezone.spec.ts
🧠 Learnings (20)
📓 Common learnings
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/elements/Timestamp/DateTimeFormats.spec.tsx:20-23
Timestamp: 2026-03-06T18:09:17.867Z
Learning: In the RocketChat/Rocket.Chat gazzodown package (`packages/gazzodown`), tests are intended to run under the UTC timezone, but as of PR `#39397` this is NOT yet explicitly enforced in `jest.config.ts` or the `package.json` test scripts (which just run `jest` without `TZ=UTC`). To make timezone-sensitive snapshot tests reliable across all environments, `TZ=UTC` should be added to the test scripts in `package.json` or to `jest.config.ts` via `testEnvironmentOptions.timezone`. Without explicit UTC enforcement, snapshot tests involving date-fns formatted output or `toLocaleString()` will fail for contributors in non-UTC timezones.
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/elements/Timestamp/RelativeTime.spec.tsx:63-70
Timestamp: 2026-03-06T18:02:20.381Z
Learning: In RocketChat/Rocket.Chat, tests in the `packages/gazzodown` package (and likely the broader test suite) are always expected to run in the UTC timezone. This makes `toLocaleString()` output deterministic, so snapshot tests that include locale/timezone-sensitive content (such as `title` attributes from `toLocaleString()`) are stable and do not need to be replaced with targeted assertions.
📚 Learning: 2026-03-06T18:09:17.867Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/elements/Timestamp/DateTimeFormats.spec.tsx:20-23
Timestamp: 2026-03-06T18:09:17.867Z
Learning: In the RocketChat/Rocket.Chat gazzodown package (`packages/gazzodown`), tests are intended to run under the UTC timezone, but as of PR `#39397` this is NOT yet explicitly enforced in `jest.config.ts` or the `package.json` test scripts (which just run `jest` without `TZ=UTC`). To make timezone-sensitive snapshot tests reliable across all environments, `TZ=UTC` should be added to the test scripts in `package.json` or to `jest.config.ts` via `testEnvironmentOptions.timezone`. Without explicit UTC enforcement, snapshot tests involving date-fns formatted output or `toLocaleString()` will fail for contributors in non-UTC timezones.

Applied to files:

  • apps/meteor/client/views/omnichannel/businessHours/EditBusinessHours.tsx
  • packages/tools/src/timezone.ts
  • apps/meteor/client/views/admin/settings/Setting/inputs/SelectTimezoneSettingInput.tsx
  • apps/meteor/client/hooks/useTimezoneNameList.ts
  • packages/tools/src/timezone.spec.ts
📚 Learning: 2026-03-18T16:08:17.800Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 39590
File: apps/meteor/client/views/omnichannel/contactInfo/EditContactInfo.tsx:97-99
Timestamp: 2026-03-18T16:08:17.800Z
Learning: In `apps/meteor/client/views/omnichannel/contactInfo/EditContactInfo.tsx`, `reValidateMode: 'onBlur'` is intentionally used (not 'onChange') because the `validateEmailFormat` and `validatePhone` functions are async and call the `checkExistenceEndpoint` API to check for duplicates. Using 'onChange' would trigger excessive network requests on every keystroke. The combination of `mode: 'onSubmit'` with `reValidateMode: 'onBlur'` is a deliberate design decision to minimize API calls while still providing revalidation feedback.

Applied to files:

  • apps/meteor/client/views/omnichannel/businessHours/EditBusinessHours.tsx
📚 Learning: 2026-03-06T18:02:20.381Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/elements/Timestamp/RelativeTime.spec.tsx:63-70
Timestamp: 2026-03-06T18:02:20.381Z
Learning: In RocketChat/Rocket.Chat, tests in the `packages/gazzodown` package (and likely the broader test suite) are always expected to run in the UTC timezone. This makes `toLocaleString()` output deterministic, so snapshot tests that include locale/timezone-sensitive content (such as `title` attributes from `toLocaleString()`) are stable and do not need to be replaced with targeted assertions.

Applied to files:

  • apps/meteor/client/views/omnichannel/businessHours/EditBusinessHours.tsx
  • apps/meteor/client/hooks/useTimezoneNameList.ts
  • packages/tools/src/timezone.spec.ts
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • apps/meteor/client/views/omnichannel/businessHours/EditBusinessHours.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/SelectTimezoneSettingInput.tsx
📚 Learning: 2025-10-17T12:36:01.020Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 37250
File: apps/meteor/app/autotranslate/server/deeplTranslate.ts:122-126
Timestamp: 2025-10-17T12:36:01.020Z
Learning: In JavaScript, `new Intl.Locale(language).toString()` returns a BCP-47 compliant identifier but only canonicalizes the input—it does not add regional subtags. For example, `new Intl.Locale("en").toString()` returns `"en"`, not `"en-US"`. To map base language codes to full BCP-47 codes with regional subtags (e.g., "en" → "en-US"), use explicit mapping or a dedicated helper function.

Applied to files:

  • packages/tools/src/timezone.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • packages/tools/src/timezone.ts
  • apps/meteor/client/hooks/useTimezoneNameList.ts
  • packages/tools/src/timezone.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • packages/tools/src/timezone.ts
  • apps/meteor/client/hooks/useTimezoneNameList.ts
  • packages/tools/src/timezone.spec.ts
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/hooks/useTimezoneNameList.ts
📚 Learning: 2026-04-14T21:10:31.855Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 36292
File: apps/meteor/client/hooks/useHasValidLocationHash.ts:7-12
Timestamp: 2026-04-14T21:10:31.855Z
Learning: When reviewing files in apps/meteor/client/hooks/, do not treat JSDoc-style comments on React hooks (especially exported hooks) as a violation of any “avoid code comments in implementation” guideline. It’s acceptable to use JSDoc to document the public API of exported hooks (e.g., parameter/return types, intended usage), as long as it documents behavior/contracts rather than adding narrative implementation comments.

Applied to files:

  • apps/meteor/client/hooks/useTimezoneNameList.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • packages/tools/src/timezone.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • packages/tools/src/timezone.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests

Applied to files:

  • packages/tools/src/timezone.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests

Applied to files:

  • packages/tools/src/timezone.spec.ts
📚 Learning: 2025-12-10T21:00:43.645Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:43.645Z
Learning: Adopt the monorepo-wide Jest testMatch pattern: <rootDir>/src/**/*.spec.{ts,js,mjs} (represented here as '**/src/**/*.spec.{ts,js,mjs}') to ensure spec files under any package's src directory are picked up consistently across all packages in the Rocket.Chat monorepo. Apply this pattern in jest.config.ts for all relevant packages to maintain uniform test discovery.

Applied to files:

  • packages/tools/src/timezone.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • packages/tools/src/timezone.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests

Applied to files:

  • packages/tools/src/timezone.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory

Applied to files:

  • packages/tools/src/timezone.spec.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • packages/tools/src/timezone.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • packages/tools/src/timezone.spec.ts
🔇 Additional comments (3)
packages/tools/src/timezone.ts (1)

38-44: LGTM — minimal, defensive helper.

The try/catch fall-through to the original input keeps the previous behavior for unrecognized values, and Intl.DateTimeFormat does the alias resolution required to fix the legacy-zone regression. Consumers just need to keep in mind that the returned canonical name may not exist in useTimezoneNameList() on engines whose Intl.supportedValuesOf('timeZone') excludes it (in practice this is unlikely for canonical IANA names since the spec requires they be present, modulo UTC which is already special-cased).

apps/meteor/client/views/omnichannel/businessHours/EditBusinessHours.tsx (1)

16-31: LGTM — gradual migration to canonical form is clean.

Using useForm({ values: ... }) (rather than defaultValues) ensures isDirty baselines on the canonicalized value, so the Save button won't spuriously activate just because an alias was rewritten on load. Combined with timezone: data.timezoneName on save (line 64), legacy aliases get persisted in canonical form on the user's next deliberate save — consistent with the PR description.

packages/tools/src/timezone.spec.ts (1)

12-23: The test suite is stable on the CI as configured. Node 22.16.0 is pinned in the monorepo, which includes full-icu by default, guaranteeing support for all tested timezone canonicalizations (Etc/GMT → UTC, GMT → UTC, Zulu → UTC, Universal → UTC, US/Pacific → America/Los_Angeles, Japan → Asia/Tokyo). The canonicalizeTimezone function delegates purely to Intl.DateTimeFormat().resolvedOptions().timeZone, which implements ECMA‑402 canonicalization independent of the local system timezone, making these mappings deterministic and reliable across all Node 22 environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants